package com.cheer.vo;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import com.cheer.entity.LecCourseEntity;
import com.cheer.entity.LecTeacherEntity;
import com.cheer.enums.SexTypeEnum;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;


/**
 * 课程导出
 */
@Data
public class LecTeacherExportVO {

    private String name;

    private String sex;

    private String age;

    private String phone;

    private String account;

    private String province;

    private String department;

    private String profession;

    private String count;

    private Integer score;

    private String direction;

    private String description;

    public static final Map<String, String> headerAlias = Maps.newLinkedHashMap();

    static{
        headerAlias.put("name","姓名");
        headerAlias.put("sex","性别");
        headerAlias.put("age","年龄");
        headerAlias.put("phone","联系电话");
        headerAlias.put("account","账号");
        headerAlias.put("province","省份");
        headerAlias.put("department","机关单位");
        headerAlias.put("profession","职务");
        headerAlias.put("count","课程次数");
        headerAlias.put("score", "宣讲积分");
        headerAlias.put("direction","宣讲方向");
        headerAlias.put("description","简介");
    }

    /**
     * @see LecTeacherVO
     * 将 List<LecTeacherVO> 转换成List<LecTeacherExportVO>
     * @return
     */
    public static List<LecTeacherExportVO> convertToLecTeacherExportVOs( List<LecTeacherVO> lecTeacherVOS ){


        List<LecTeacherExportVO> lecTeacherExportVOS = Lists.newArrayList();
        for (int i = 0; i < lecTeacherVOS.size(); i++) {

            LecTeacherExportVO lecTeacherExportVO = new LecTeacherExportVO();
            LecTeacherVO lecTeacherVO = lecTeacherVOS.get(i);
            BeanUtil.copyProperties(lecTeacherVO, lecTeacherExportVO, true);
            if(lecTeacherVO.getSex() != null){
                lecTeacherExportVO.setSex(SexTypeEnum.getByTypeCode(Integer.valueOf(lecTeacherVO.getSex())).getDesc());
            }
            lecTeacherExportVOS.add(lecTeacherExportVO);
        }

        return lecTeacherExportVOS;

    }





}
